package com.demo.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {
    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Knife4j + OpenAPI3 接口文档示例")
                        .description("这是一个基于 Knife4j 4.x + OpenAPI3 的示例项目")
                        .version("1.0")
                        .contact(new Contact().name("作者").url("https://github.com").email("example@example.com"))
                        .license(new License().name("Apache 2.0").url("http://springdoc.org"))
                )
                .externalDocs(new ExternalDocumentation()
                        .description("Knife4j 官方文档")
                        .url("https://doc.xiaominfo.com/knife4j/documentation/get_start.html")
                );
    }
}